package com.gbb.common.adapter;

import java.util.List;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;

/**
 * 封装Adapter适用于只有一个布局文件的ListView
 *
 * @author gaobingbing
 * @see com.gbb.common.tools.ViewHolder#get(View,int)
 */
public abstract class SimpleAdapter<T> extends AbstractAdapter<T> {

    public SimpleAdapter(Context mContext,List<T> dataList){
        super(mContext,dataList);
    }

    public abstract int getListViewItemId();

    @Override
    public View getView(int position,View convertView,ViewGroup parent){
        if(convertView == null) {
            convertView = mInflater.inflate(getListViewItemId(),parent,false);
        }
        convert(position,convertView,getItem(position));
        return convertView;
    }

    public abstract void convert(int position,View convertView,T dataItem);

}
